<?php
// +----------------------------------------------------------------------
// | SparkShop 坚持做优秀的商城系统
// +----------------------------------------------------------------------
// | Copyright (c) 2022~2099 http://sparkshop.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai  <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\command;

use addons\seckill\model\SeckillActivity;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class SeckillOverTime extends Command
{
    protected function configure()
    {
        $this->setName('SeckillOverTime')
            ->setDescription('SparkShop商城秒杀超时关闭');
    }

    protected function execute(Input $input, Output $output)
    {
        (new SeckillActivity())->where('end_time', '<', now())->update([
            'status' => 3,
            'update_time' => now()
        ]);
    }
}